package org.omg.GIOP;

//
// Helper class for : LocateRequestHeader_1_2
//
// @author OpenORB Compiler
//
public class LocateRequestHeader_1_2Helper {
	//
	// Insert LocateRequestHeader_1_2 into an any
	// @param a an any
	// @param t LocateRequestHeader_1_2 value
	//
	public static void insert(org.omg.CORBA.Any a,
			org.omg.GIOP.LocateRequestHeader_1_2 t) {
		a.insert_Streamable(new org.omg.GIOP.LocateRequestHeader_1_2Holder(t));
	}

	//
	// Extract LocateRequestHeader_1_2 from an any
	// @param a an any
	// @return the extracted LocateRequestHeader_1_2 value
	//
	public static org.omg.GIOP.LocateRequestHeader_1_2 extract(
			org.omg.CORBA.Any a) {
		return read(a.create_input_stream());
	}

	//
	// Internal TypeCode value
	//
	private static org.omg.CORBA.TypeCode _tc = null;
	private static boolean _working = false;

	//
	// Return the LocateRequestHeader_1_2 TypeCode
	// @return a TypeCode
	//
	public static org.omg.CORBA.TypeCode type() {
		if (_tc == null) {
			synchronized (org.omg.CORBA.TypeCode.class) {
				if (_tc != null)
					return _tc;
				if (_working)
					return org.omg.CORBA.ORB.init().create_recursive_tc(id());
				_working = true;
				org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
				org.omg.CORBA.StructMember[] _members = new org.omg.CORBA.StructMember[2];

				_members[0] = new org.omg.CORBA.StructMember();
				_members[0].name = "request_id";
				_members[0].type = orb
						.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong);
				_members[1] = new org.omg.CORBA.StructMember();
				_members[1].name = "target";
				_members[1].type = org.omg.GIOP.TargetAddressHelper.type();
				_tc = orb.create_struct_tc(id(), "LocateRequestHeader_1_2",
						_members);
				_working = false;
			}
		}
		return _tc;
	}

	//
	// Return the LocateRequestHeader_1_2 IDL ID
	// @return an ID
	//
	public static String id() {
		return _id;
	}

	private final static String _id = "IDL:omg.org/GIOP/LocateRequestHeader_1_2:1.0";

	//
	// Read LocateRequestHeader_1_2 from a marshalled stream
	// @param istream the input stream
	// @return the readed LocateRequestHeader_1_2 value
	//
	public static org.omg.GIOP.LocateRequestHeader_1_2 read(
			org.omg.CORBA.portable.InputStream istream) {
		org.omg.GIOP.LocateRequestHeader_1_2 new_one = new org.omg.GIOP.LocateRequestHeader_1_2();

		new_one.request_id = istream.read_ulong();
		new_one.target = org.omg.GIOP.TargetAddressHelper.read(istream);

		return new_one;
	}

	//
	// Write LocateRequestHeader_1_2 into a marshalled stream
	// @param ostream the output stream
	// @param value LocateRequestHeader_1_2 value
	//
	public static void write(org.omg.CORBA.portable.OutputStream ostream,
			org.omg.GIOP.LocateRequestHeader_1_2 value) {
		ostream.write_ulong(value.request_id);
		org.omg.GIOP.TargetAddressHelper.write(ostream, value.target);
	}

}
